package cbsc.cha4.s6;

public class WhiteBoxTester {
    
    /**
     * Creates a new instance of <code>WhiteBoxTester</code>.
     */
    public WhiteBoxTester() {
    }
    
    public String generateOperation (int left, int right, char operator) {
		int value=0;
		if (0<=left && left<=100 && 0<=right && right<=100) {
			if (operator == '+'){
				value = left + right;
				if ( value <= 100){
					return ""+left+operator+right+"="+value; 
				} else {
					return "Error_1";
				}
			} else if (operator == '-'){
				value = left - right;
				if (value >= 0 ){
					return ""+left+operator+right+"="+value;
				} else {
					return "Error_2";
				}
			} else {
				return "Error_3";
			}
		} else {
			return "Error_4";
		}
	}
	public static void generateOperationTester(){
		WhiteBoxTester wbt = new WhiteBoxTester();
        String result="";
        result = wbt.generateOperation(57,35,'+');
        System.out.println(result);
        result = wbt.generateOperation(57,35,'-');
        System.out.println(result);
        result = wbt.generateOperation(57,55,'+');
        System.out.println(result);
        result = wbt.generateOperation(57,95,'-');
        System.out.println(result);
	}
    public static void main(String[] args) {
        generateOperationTester();
    }
}

